import request from '@/config/axios'

export interface ChannelVO {
        id: number
        name: string
        code: string
}

// 查询广告渠道列表
export const getChannelPage = async (params) => {
    return await request.get({url: `/ad/channel/page`, params})
}

// 查询广告渠道simpleList列表
export const getChannelSimpleList = async () => {
    return await request.get({url: `/ad/channel/simple-list`})
}


// 查询广告渠道详情
export const getChannel = async (id: number) => {
    return await request.get({url: `/ad/channel/get?id=` + id})
}

// 新增广告渠道
export const createChannel = async (data: ChannelVO) => {
    return await request.post({url: `/ad/channel/create`, data})
}

// 修改广告渠道
export const updateChannel = async (data: ChannelVO) => {
    return await request.put({url: `/ad/channel/update`, data})
}

// 删除广告渠道
export const deleteChannel = async (id: number) => {
    return await request.delete({url: `/ad/channel/delete?id=` + id})
}

// 导出广告渠道 Excel
export const exportChannel = async (params) => {
    return await request.download({url: `/ad/channel/export-excel`, params})
}
